Chris Pollett > Old Classses >
CS174

( Print View )

Student Corner:
  [Grades Sec1]
  [Submit Sec1]
  [Class Sign Up Sec1]
  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [Class Protocols]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#3 --- last modified February 07 2019 04:37:40..

Solution set.

Due date: Oct 30

Files to be submitted:
  Hw3.zip

Purpose: To experiment using a version control program for managing your projects. To write web programs which make use of a database. To learn how to validate simple forms using Javascript.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

LO3 -- Write server-side scripts that process HTML forms.

LO4 -- Write client-side scripts that validate HTML forms.

LO5 -- Develop and deploy web applications that involve components, web services, and databases.

Specification:

For this homework you will build a site called Looney Limericks. It is supposed to be a showcase site for especially entertaining limericks. Recall a limerick is a five line nonsense poem with rhyme scheme AABBA and where every three syllables in a line are said in a unstressed, unstressed, stressed pattern. For the purposes of the Looney Limericks no poem on the site is allowed to have a line length longer than thirty characters. When a user comes to the site, the landing page should have the Looney Limericks title and the top header should also say Looney Limericks. Beneath this there should be a featured poem. This should be selected at random every ten minutes. Your server code should record in a DB when the last time a featured poem was selected, if this was more than ten minutes ago, select a new one. On all pages on the site there should also be a list of the titles of the top 10 highest rated poems and the 10 most recently submitted poems. There should be a link to choose a poem at random from the database and there should be a link to upload a poem. When a poem is displayed there should be two star gadgets: User rating and Your rating. These should display five stars, where a star is either filled in yellow, half-filled yellow and gray, or solid gray (half-filled is only for User rating). The former of the two gadgets displays the current average user rating for the poem rounded to the nearest half-star, the latter gadget is click-able and allows a person to give a poem their own rating (which is saved back on the server in a DB table for the average rating as well as in a session variable). Clicking of a title link for either one of the highest rated or most recent poems should display that poem. The random poem link should display a poem at random from amongst the poems stored on the site. Clicking on the submit a poem link should take the user to a form which gets the following pieces of information: the title of the poem, the author of the poem, and from a text area the poem itself. The title and author data should each be no more than 30 characters long. Using Javascript you should verify the line lengths of title, author, and each line of the limerick before sending any data to the server. It should also check the number of lines in the poem. Accepted poem information should be stored in a database. On the server, you should clean the data before saving it into the database (at a minimum, mysqli_escape_string). The server should also attempt to validate the rhyme scheme before accepting a poem. This might be done using the soundex() or metaphone() functions in PHP. You can assume the language of submissions is English. If a poem submission is not valid you should give an appropriate error message.

The Looney Limericks site should have the same folder organization as for homework 2. The roles of views, models, and controllers should be the same. In particular, only models should communicate with the database. For this homework, you should make use of classes for view, models, and controllers though. A view should extend from a base view class, etc. The DBMS for this homework should be MySQL (I'll allow Postgres if you use PDO and put all the relevant connection stuff that might need to be changed in config.php). config.php should have a configuration constants for things like database username and password. The config folder should have a file create.php which when run from the command line creates the initial database for the grader. You should have a readme.txt file listing group members and any instructions for the grader. I'll files you submit should follow the guidelines for white-space, etc. established in Hw1. All HTML generated on your site should W3C validate as either XHTML 1.1 or HTML 5. The tables you use for your project should be in BCNF. You should not use any external style or Javascript that is not of your own creation. I.e., no YUI no jQuery, etc.

The final aspect of this assignment is to use git version control while creating your app. Your Hw3.zip file that you submit should be a zip file of your git repository. Break the assignment into at least six issues/bugs. In the config folder, have a file issues.txt where you list these issues and for each issue, list the team member responsible for that issue. Your git repository should have regular commits into it that correspond to these issues and maybe sub-issues. No more than hundred lines should change between commits. Commits should be time-wise far enough apart that a human could actually have typed the information that is being committed.

Point Breakdown

Landing page as described1pt
Top 10 favorite poems correctly calculated (1/2pt), links for top 10 poems appear on each page and link to a page displaying that poem (1/2pt)1pt
Top 10 most recent poems correctly calculated (1/2pt), links for top 10 recent poems appear on each page and link to a page displaying that poem (1/2pt)1pt
User rating and your rating star gadgets work as described (1/2pt each)1pt
Link to submit poem form works and form page itself as described (1/2pt each) 1pt
Javascript validation of submit form poem data before it is sent to server (1/2pt), server cleaning of data and checking of rhyme scheme (1/2pt)1pt
PHP Session used for stars in Your rating(1/2pt), poem data stored in a dbms and data for statistics needed to compute favorite poems, most recent poems, and user rating stored in a dbms (1/2pt)1pt
readme.txt and config.php as described (1/4pt), Hw1 coding guidelines followed (1/2pt), Hw2 file organization but with PHP class hierachies(1/2pt), pages W3C validate (1/2pt), database tables in BCNF (1/4pt)2pts
Hw is in a Git repository is as described (1/2pt for commits as described) (1/2pt for issues.txt) 1pt
Total10pts